package serviceImpl;

import java.util.ArrayList;

import dao.MallDao;
import daoImpl.MallDaoImpl;
import pojo.Book;
import pojo.BookImage;
import pojo.MallHomeImage;
import pojo.ShoppingCart;
import service.MallService;

public class MallServiceImpl implements MallService{

	
	
	
	@Override
	public ArrayList<Book> queryBookByName(String book) {
		MallDao md = new MallDaoImpl();
		ArrayList<Book> bList = md.queryBookByName(book);
		return bList;
	}

	@Override
	public ArrayList<MallHomeImage> getHomeIma() {
		MallDao md = new MallDaoImpl();
		ArrayList<MallHomeImage> mhiList = md.getHomeIma();
		return mhiList;
	}

	@Override
	public ArrayList<Book> getBooks() {
		MallDao md = new MallDaoImpl();
		ArrayList<Book> bList = md.getBooks();
		return bList;
	}

	@Override
	public ArrayList<BookImage> getBookImages(int bookid) {
		MallDao md = new MallDaoImpl();
		ArrayList<BookImage> bImaList = md.getBookImages(bookid);
		return bImaList;
	}

	@Override
	public ArrayList<ShoppingCart> getCartBook(int userid) {
		MallDao md = new MallDaoImpl();
		ArrayList<ShoppingCart> cartList = md.getCartBook(userid);
		return cartList;
	}

	@Override
	public int getCartBook(int userid, int bookid) {
		MallDao md = new MallDaoImpl();
		int suc = md.getCartBook(userid,bookid);
		return suc;
	}

	@Override
	public int carRemove(int scid) {
		MallDao md = new MallDaoImpl();
		int suc = md.carRemove(scid);
		return suc;
	}

	@Override
	public int toPay(int userid, float money) {
		MallDao md = new MallDaoImpl();
		int suc = md.toPay(userid,money);
		return suc;
	}

	@Override
	public int emptyCart(int userid) {
		MallDao md = new MallDaoImpl();
		int suc = md.emptyCart(userid);
		return suc;
	}

}
